/***********************************************************
* Purpose : delete Category
* Author : NuoiNV
* Date: 19/1/2012
* Description: delete Category
*/
IF EXISTS ( SELECT * FROM SYSOBJECTS WHERE NAME = 'sp_deleteCategory' ) 
BEGIN
	DROP PROC sp_deleteCategory
END
GO
CREATE PROC sp_deleteCategory
	@ID	INT,
	@RESULT INT OUTPUT
AS
	BEGIN 
		IF NOT EXISTS (SELECT * FROM Question  WHERE Category_ID = @ID)
		Begin
			DELETE Category_Question WHERE ID = @ID
			SET @RESULT = 1
		END
		ELSE
		BEGIN
		SET @RESULT = 0
		END
	END 